package jjn.round1;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Jjn
 * @since 2022/10/4 23:40
 */
public class LeetCode401_BinaryWatch {
    public List<String> readBinaryWatch(int turnedOn) {
        List<String> result = new ArrayList<>();
        for (int hour = 0; hour < 12; hour++) {
            for (int minute = 0; minute < 60; minute++) {
                if (Integer.bitCount(hour) + Integer.bitCount(minute) == turnedOn) {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append(hour);
                    stringBuilder.append(":");
                    if (minute < 10) {
                        stringBuilder.append("0");
                    }
                    stringBuilder.append(minute);
                    result.add(stringBuilder.toString());
                }
            }
        }
        return result;
    }
}
